<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>事件跟踪</title>
<%@ include file="/commons/commonList.jsp"%>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/ajaxException.js"></script>

<script type="text/javascript">
	var currentID = null;
	var validity = null;
	function openTrackRecordAdd(){ //添加事件跟踪
		var url = "${ctx}/customerService_trackRecordAction.do?method=checkAddQuestionairIsTtue&eventId=${eventID}";
		var params = "eventID=${eventID}";
		sendAjaxRequest(url,params,function(result){
			ajaxSubmitException(result.responseText);
			var urlOther= "${ctx}/customerService_trackRecordAction.do?method=initAdd&eventId=${eventID}";
			top.windowOpen(urlOther, "trackRecordAdd", "事件跟踪登记", 320, 590,true,"trackRecordAddFrame");
		});
	}
	function openCheckAside(){ //确认是否作废
		if(currentID == null) return;
		if(validity == 0){
			Alert("只有新建状态得跟踪信息才能作废");
			return;
		}
		var url = "${ctx}/customerService_trackRecordAction.do?method=validateAside";
		var params = "eventID=${eventID}&keyword=" + currentID;
		sendAjaxRequest(url,params,function(result){
			ajaxSubmitException(result.responseText);
			AskConfirm("您确定要作废此记录吗?","trackRecordFrame","openAside");
		});

	}
	function openAside(){
		var url = "${ctx}/customerService_trackRecordAction.do?method=initAside&eventId=${eventID}&trackRecordID=" + currentID;
		top.windowOpen(url,"asideTrackRecord","作废",230,400,true,"asideTrackRecordFrame");
		currentID = null;
	}
	function openDetail(keyword){
		var urlOther= "${ctx}/customerService_trackRecordAction.do?method=initDetail&keyword=" + keyword;
		top.windowOpen(urlOther, "trackRecordAdd", "事件跟踪详细", 320, 590,true,"trackRecordAddFrame");
	}
	function flushFrame(){
		var url = "${ctx}/customerService_trackRecordAction.do?method=initMain&customerServiceEventID=${eventID}";
	  	document.location.href = url;
	}
</script>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><span class="window_head_intext"><img src="${ctx}/images/ico_Advance.gif" align="absmiddle" />&nbsp;事件跟踪</span></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td valign="middle" class="content">

	<table width="100%" border="0" cellpadding="0" cellspacing="1">
          <tr>
            <td>

<div>
  <table width="100%" border="0" cellpadding="0" cellspacing="0"   class="tab_line">
    <tr>
      <td class="bg_toolBar"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>&nbsp;</td>
          <td align="right"><!--------------------------右边图标01----------------------------------->
                <table border="0" cellpadding="0" cellspacing="0" id="ico1">
                  <tr>
                  <pms:AuthTag authName="customerService_trackRecordAction.do?method=initAdd">
                   <td class="toolbarico">
                   	<a href="#" onClick="openTrackRecordAdd();"onfocus="this.blur()">
                   		<img src="${ctx}/images/ico_newfile.gif" border="0" align="absbottom" alt="添加事件跟踪"/>&nbsp;
                   	</a>
                   </td>
                   </pms:AuthTag>
                  <pms:AuthTag authName="customerService_trackRecordAction.do?method=initAside">
                  <td class="toolbarico">
                  	<a href="#" onClick="openCheckAside();" onFocus="this.blur()">
                  		<img src="${ctx}/images/ico_delete.gif" alt="作 废" width="16" height="16" border="0" align="absbottom" />
                  	</a>
                  </td>

                  </pms:AuthTag>

                  </tr>
                </table>
            </td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td valign="top">
      <div style="overflow:auto; height:300px;">
      	  <ec:ceTable items="trackRecords"
				action="${ctx}/customerService_trackRecordAction.do?method=initMain&customerServiceEventID=${eventID}"
				var="trackRecordItem"
				view="pmsview"
				styleClass="gridData2"
				rowsDisplayed="10" >
				<ec:ceRow styleClass="grid"
					onclick="currentID=${trackRecordItem.keyword};validity=${trackRecordItem.validity}"
					ondblclick="openDetail('${trackRecordItem.keyword}');"
					onContextMenu="return ShowContextMenu(event,'quick_rightmenu');">
					<ec:ceColumn headerCell="pmsHeadrCell" title="事件编号" property="eventNo" sortable="false" width="14%" />
					<ec:ceColumn headerCell="pmsHeadrCell" title="详细地点" property="fullAddress" sortable="false" width="7%"/>
					<ec:ceColumn headerCell="pmsHeadrCell" title="房 号" property="houseNumber" sortable="false" width="6%" />
					<ec:ceColumn headerCell="pmsHeadrCell" title="联系人" property="client" sortable="false" width="8%" />
					<ec:ceColumn headerCell="pmsHeadrCell" title="事件跟踪描述" property="remark" sortable="false" width="8%" />
					<ec:ceColumn headerCell="pmsHeadrCell" title="跟踪人" property="recorder" sortable="false" width="8%" />
					<ec:ceColumn headerCell="pmsHeadrCell" title="事件跟踪状态" property="validity" sortable="false" width="8%">
						<c:choose>
							<c:when test="${trackRecordItem.validity == '1'}">有效</c:when>
							<c:when test="${trackRecordItem.validity == '0'}">作废</c:when>
						</c:choose>
					</ec:ceColumn>
					<ec:ceColumn headerCell="pmsHeadrCell" title="日期" property="recordTime" sortable="false" width="15%" />
				</ec:ceRow>
			</ec:ceTable>
		</div>
      </td>
    </tr>
  </table>
</div></td>
            </tr>
        </table>

	</td>
  </tr>
  <tr>
    <td colspan="2" class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>&nbsp;</td>
          <td class="btn_between_space"></td>
          <td>
          </td>
          <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td class="buttonOffLeft" id="btn1_31"></td>
                <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 关 闭</td>
                <td class="buttonOffRight" id="btn1_33"></td>
              </tr>
          </table></td>
        </tr>
          </table>
      <p>&nbsp;</p></td>
  </tr>
</table>

<!--------------------右键1---------------------->
<div id="quick_rightmenu" style="display:none;" oncontextmenu="return false" class="quick_rightmenu">
  <table width="100%" border="0" cellpadding="1" cellspacing="0" class="grid_quickMenu_bg">
    <tr>
      <td><table width="100%" border="0" cellpadding="2" cellspacing="0">
        <pms:AuthTag authName="customerService_trackRecordAction.do?method=initAdd">
        <tr>
         <td class="quickMenu_toolbarico">
         	<a href="#"  onClick="openTrackRecordAdd();"onFocus="this.blur()">
         		<img src="${ctx}/images/ico_newfile.gif" border="0" align="absbottom" alt="新增"/>&nbsp;新 增
         	</a>
         </td>
        </tr>
         </pms:AuthTag>
         <pms:AuthTag authName="customerService_trackRecordAction.do?method=initAside">
        <tr>
          <td class="quickMenu_toolbarico">
          	<a href="#" onFocus="this.blur()" onClick="openCheckAside();">
          		<img src="${ctx}/images/ico_delete.gif" alt="删除" border="0" align="absbottom"/>&nbsp;作 废
          	</a>
          </td>
          </tr>
        </pms:AuthTag>
  </table>
  </td>
          </tr>
  </table>

 <script type="text/javascript">

	var trackRecorddiv=document.getElementById('quick_rightmenu');
	if(trackRecorddiv.getElementsByTagName("tr").length==1){
	trackRecorddiv.innerHTML="";
	}
</script>
</div>
</body>
</html>